<form id="listForm" method="post">
<input type="hidden" id="categoryId" name="categoryId" value="#(categoryId)" />
<!-- 数据表格 -->
<div class="table-box">
	<!--搜索栏-->
	<div class="form-horizontal clear">
		<div class="form-group">
			<label class="col-sm-1 control-label">标题：</label>
			<div class="col-sm-2"><input class="form-control" type="text" name="title" value="#(title)"></div>
		</div>
		<div class="text-center">
			<input type="submit" class="btn btn-primary btn-w-m" value="查 询">
			<input type="reset" class="btn btn-primary btn-w-m" value="重 置">
		</div>
	</div>
	<!--搜索栏/-->
	<!--工具栏-->
	<div class="pull-left">
		<div class="form-group form-inline">
			<div class="btn-group">
				#if(categoryId??)<button type="button" class="btn btn-default" id="addButton" categoryId="#(categoryId)"><i class="fa fa-file-o"></i> 新建</button>#end
				<button type="button" class="btn btn-default disabled" id="deleteButton" url="#(base)/admin/content/delete"><i class="fa fa-trash-o"></i> 删除</button>
				<button type="button" class="btn btn-default" id="localRefreshButton"><i class="fa fa-refresh"></i> 刷新</button>
				<button type="button" class="btn btn-default" id="sortButton" url="#(base)/admin/content/updateSort"><i class="fa fa-sort"></i> 排序</button>
			</div>
		</div>
	</div>
	<!--工具栏/-->
	<!--数据列表-->
	<table id="listTable"
		class="table table-bordered table-striped table-hover dataTable">
		<thead>
			<tr>
				<th width="40"><input type="checkbox" id="selectAll" /></th>
				<th>ID</th>
                <th>栏目</th>
                <th>标题</th>
                <th>发布日期</th>
                <th>状态</th>
                <th>置顶</th>
                <th>推荐</th>
                <th>头条</th>
                <th>访问量</th>
                <th width="40">排序</th>
                <th>操作</th>
			</tr>
		</thead>
		<tbody id="listTr">
			#for(content : page.list)
			<tr>
				<td><input type="checkbox" name="ids" value="#(content.id)" /></td>
				<td>#(content.id)</td>
				<td>#(content.category.name)</td>
				<td>#(content.title)</td>
				<td>#date(content.publishDate,'yyyy-MM-dd HH:mm:ss')</td>
				<td><input type="checkbox" class="js-switch-small switchbox" #if(content.status==1) checked #end data-id="#(content.id)" data-url="#(base)/admin/content/updateStatus"/></td>
				<td><input type="checkbox" class="js-switch-small switchbox" #if(content.isTop) checked #end data-id="#(content.id)" data-url="#(base)/admin/content/updateIsTop"/></td>
				<td><input type="checkbox" class="js-switch-small switchbox" #if(content.isRecommend) checked #end data-id="#(content.id)" data-url="#(base)/admin/content/updateIsRecommend"/></td>
				<td><input type="checkbox" class="js-switch-small switchbox" #if(content.isHeadline) checked #end data-id="#(content.id)" data-url="#(base)/admin/content/updateIsHeadline"/></td>
				<td>#(content.visits)</td>
				<td><input type="text" class="form-control" name="sorts" value="#(content.sort)" data-oldsort="#(content.sort)" data-id="#(content.id)" /></td>
				<td>
					<button type="button" class="btn bg-olive btn-xs editButton" contentId="#(content.id)">编辑</button>
				</td>
			</tr>
			#end
		</tbody>
	</table>
	<!--数据列表/-->
</div>
<!-- 数据表格 /-->
<!-- .box-footer-->
#page(pageNumber = page.pageNumber,totalPages = page.totalPage,pattern ="") 
#include("../include/page.html") 
#end
<!-- /.box-footer-->
</form>
<script type="text/javascript">
var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch-small'));
elems.forEach(function(html) {
  var switchery = new Switchery(html, { size: 'small' });
});
$().ready(function() {
	
	// 表单提交
	$("#listForm").submit(function(){
		loadData(getFormData($("#listForm")));
		return false;
	});
	
	// 刷新
	$("#localRefreshButton").on("click",function(){
		$("#listForm").submit();
	});

});
</script>
